

function getCardPoints(card) {
	if (card.joker == true) {
		return 20;
	}
	if (card.number == 'Ace') {
		return 15;
	}
	if (card.number == 'King' || card.number == 'Queen' || card.number == 'Jack') {
		return 10;
	}
	return parseInt(card.number);
}

function getWinners(totals) {
	var lowScore = 9999999;
	var lowId = null;
	for (id in this.totals) {
		if (this.totals[id] < lowScore) {
			lowScore = this.totals[id];
			lowId = id;
		}
	}
	
	return [lowId];
}

function sortCards(a, b){
	
	if (a.joker == true) {
		return 1;
	}
	if (b.joker == true) {
		return -1;
	}
	
	var suitOrder = [
	    'Hearts',
	    'Spades',
	    'Diamonds',
	    'Clubs'
	];
	
	var suitA = suitOrder.indexOf(a.suit);
	var suitB = suitOrder.indexOf(b.suit);
		
	var diff = (suitA - suitB);
	
	if (diff == 0) {
	
		var indexA = a.numbers.indexOf(a.number);
		var indexB = b.numbers.indexOf(b.number);
		
		diff = (indexA-indexB);
		
	}
	
	return diff;
}